import datetime
from apps.extensions import db
class Category(db.Model):
    """分类模型"""
    __tablename__ = 'cms_category'

    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False, comment='分类名称')
    alias = db.Column(db.String(100), unique=True, nullable=False, comment='分类别名')
    desc = db.Column(db.Text, comment='分类描述')
    parent_id = db.Column(db.Integer, comment='父级分类ID')
    count = db.Column(db.Integer, default=0, comment='使用次数')
    deleted = db.Column(db.Boolean, default=False, comment='是否删除')
    created_at = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间')
    updated_at = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
